<form action="{:request()->url()}" autocomplete="off" class="layui-form layui-card" data-auto="true" method="post">
    <div class="layui-card-body padding-left-40">
        <script>
            layui.form.render();
        </script>
        <label class="layui-form-item relative block">
            <span class="color-green font-w7">设备名称</span>
            <span class="color-desc margin-left-5">name</span>
            <input class="layui-input" name="name" placeholder="{$vo.name|default='设备名称'}"
                   value="{$vo.name|default=''}"/>
            <span class="help-block">请填写设备名称，建议字符不要太长，一般4个汉字</span>
        </label>
        <div class="layui-form-item relative block">
            <span class="color-green font-w7">图片</span>
            <span class="color-desc margin-left-5">Image</span>
            <br>
            <input type="hidden" name="image" value="{$vo.image|default=''}">
            <script>$('[name=image]').uploadOneImage()</script>
            <br>
        </div>
        <label class="layui-form-item relative block">
            <span class="color-green font-w7">设备码</span>
            <span class="color-desc margin-left-5">Code</span>
            <input class="layui-input" name="code" placeholder="请输设备码" disabled
                   value="{$vo.code|default=''}"/>
            <span class="help-block"><b>必填，</b>设备码为自动生成码，请勿修改</span>
        </label>
        <label class="layui-form-item relative block">
            <span class="color-green font-w7">描述</span>
            <span class="color-desc margin-left-5">Description</span>
            <input class="layui-input" name="desc" placeholder="请输描述" required
                   value="{$vo.desc|default=''}"/>
            <span class="help-block"><b>必填，</b>请输描述</span>
        </label>
        <label class="layui-form-item relative block">
            <span class="color-green font-w7">巡查次数</span>
            <span class="color-desc margin-left-5">Num</span>
            <input class="layui-input" type="number" name="num" placeholder="请输巡查次数" required
                   value="{$vo.num|default=''}"/>
            <span class="help-block"><b>必填，</b>请输巡查次数</span>
        </label>
        <label class="layui-form-item relative block">
            <span class="color-green font-w7">位置</span>
            <span class="color-desc margin-left-5">Address</span>
            <input class="layui-input" name="address" placeholder="请输位置" required
                   value="{$vo.address|default=''}"/>
            <span class="help-block"><b>必填，</b>请输位置</span>
        </label>
        <div class="layui-form-item relative block">
            <span class="color-green font-w7">按期检查类型</span>
            <span class="color-desc margin-left-5">Type</span>
            <select class="layui-select" lay-search name="type">
                <option value="">--- 类型 ---</option>
                {foreach ["日", "周", "月", "年"] as $k => $t}
                {eq name='$vo.type|default="0"' value='$k'}
                <option selected value="{$k}">{$t|default=''}</option>
                {else}
                <option value="{$k}">{$t|default=''}</option>
                {/eq}
                {/foreach}
            </select>
        </div>
        <div class="layui-form-item relative block">
            <span class="help-label label-required-prev"><b>所属</b>Rule</span>
            <div class="layui-textarea help-checks">
                {foreach $rule as $mark}{if isset($vo.rule) && is_array($vo.rule) && in_array($mark, $vo.rule)}
                <input checked name="rule[]" title="{$mark}" type="checkbox" value="{$mark}">
                {else}
                <input name="rule[]" title="{$mark}" type="checkbox" value="{$mark}">
                {/if}{/foreach}
            </div>
        </div>
        <div class="layui-form-item relative block">
            <span class="help-label label-required-prev"><b>检查项</b>Item</span>
            <div class="layui-textarea help-checks">
                {foreach $item as $mark}{if isset($vo.item) && is_array($vo.item) && in_array($mark, $vo.item)}
                <input checked name="item[]" title="{$mark}" type="checkbox" value="{$mark}">
                {else}
                <input name="item[]" title="{$mark}" type="checkbox" value="{$mark}">
                {/if}{/foreach}
            </div>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input name='id' type='hidden' value='{$vo.id}'>{/notempty}
    {notempty name='vo.code'}<input name='code' type='hidden' value='{$vo.code}'>{/notempty}
    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" data-close data-confirm="确定要取消编辑吗？" type='button'>取消编辑</button>
    </div>
</form>